home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC]
/
NeXTSTEP 3.3 Dev Intel.iso
/
NextDeveloper
/
Source
/
GNU
/
cc
/
rtf2ascii.h
< prev
next >
Wrap
Text File
|
1994-01-04
|
1KB
|
40 lines
// rtf2ascii.h
#import <string.h>
#import <streams/streams.h>
#define RTF_HEADER "{\\rtf0\\ansi"
#define RTF_HEADER_LEN 11
// A predicate to quickly check a region of possibly-rich memory (starting
// at rtfText and going for length len) to see if it is convertible by the
// following routines.
static inline int isRTFText(const char * rtfText, int len)
{
return (rtfText
&& (len > RTF_HEADER_LEN)
&& !strncmp(rtfText, RTF_HEADER, RTF_HEADER_LEN));
}
// A memory-buffer-based conversion that reads one buffer pointed to by
// rtfTextPtr and converts, for length rtfTextLen, RTF to ASCII. A pointer
// to a newly allocated buffer of memory is returned (caller owns this
// memory). Additionally, asciiTextLen is set to the length of the
// null-terminated ascii character buffer.
extern const char * rtfToAscii( const char *rtfTextPtr,
int rtfTextLen,
int * asciiTextLen );
// A streams-based converter which takes an NXStream and either returns back
// a new memory stream that has been converted to straight ASCII (the caller
// should free this with NXCloseMemory()).
extern NXStream * rtfToAsciiStream(NXStream * possiblyRichStream);